/*
 * JThumbnailPanel.java
 *
 * Created on 7 April 2007, 14:20
 */

package usyd.comp5425.ui.imageviewer;

import javax.swing.DefaultListModel;

/**
 *
 * @author  Yuezhong Zhang
 */
public class JThumbnailPanel extends javax.swing.JPanel {
    public static final int THUMBSIZE_SMALL = 32;
    public static final int THUMBSIZE_MEDIUM = 64;
    public static final int THUMBSIZE_LARGE = 160;
    public JThumbnailPanel() {
        initComponents();
        this.setFixedCellHeight(THUMBSIZE_LARGE);
        this.setFixedCellWidth(THUMBSIZE_LARGE);
        this.imageList.setModel(new DefaultListModel());
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jScrollPane1 = new javax.swing.JScrollPane();
        imageList = new javax.swing.JList();

        setLayout(new java.awt.GridLayout(1, 1, 5, 5));

        imageList.setBorder(javax.swing.BorderFactory.createEmptyBorder(10, 10, 10, 10));
        imageList.setCellRenderer(new ImageCellRenderer());
        imageList.setDoubleBuffered(true);
        imageList.setLayoutOrientation(javax.swing.JList.HORIZONTAL_WRAP);
        imageList.setVisibleRowCount(0);
        jScrollPane1.setViewportView(imageList);

        add(jScrollPane1);

    }// </editor-fold>//GEN-END:initComponents

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JList imageList;
    private javax.swing.JScrollPane jScrollPane1;
    // End of variables declaration//GEN-END:variables
    
    /**
     * Getter for property setModel.
     * @return Value of property setModel.
     */
    public DefaultListModel getListModel() {
        return (DefaultListModel)this.imageList.getModel();
    }
    
    /**
     * Setter for property setModel.
     * @param setModel New value of property setModel.
     */
    public void setListModel(DefaultListModel model) {
        this.imageList.setModel(model);
    }
    
    
    /**
     * Getter for property fixedCellHeight.
     * @return Value of property fixedCellHeight.
     */
    public int getFixedCellHeight() {
        return this.getImageList().getFixedCellHeight();
    }
    
    /**
     * Setter for property fixedCellHeight.
     * @param fixedCellHeight New value of property fixedCellHeight.
     */
    public void setFixedCellHeight(int fixedCellHeight) {
        this.getImageList().setFixedCellHeight(fixedCellHeight);
        
    }
    
    
    public int getFixedCellWidth() {
        return this.getImageList().getFixedCellWidth();
    }
    
    /**
     * Setter for property fixedCellWidth.
     * @param fixedCellWidth New value of property fixedCellWidth.
     */
    public void setFixedCellWidth(int fixedCellWidth) {
        this.getImageList().setFixedCellWidth(fixedCellWidth);
    }
    
    public javax.swing.JList getImageList() {
        return imageList;
    }
    
    public void setImageList(javax.swing.JList imageList) {
        this.imageList = imageList;
    }
    
}
